//package com.ocom.sentinel;
//
//import com.alibaba.csp.sentinel.adapter.gateway.sc.SentinelGatewayFilter;
//import org.springframework.beans.factory.ObjectProvider;
////import org.springframework.cloud.gateway.filter.GlobalFilter;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.core.Ordered;
//import org.springframework.core.annotation.Order;
//import org.springframework.http.codec.ServerCodecConfigurer;
//import org.springframework.web.reactive.result.view.ViewResolver;
//
//import java.util.Collections;
//import java.util.List;
//
//@Primary
//@Configuration
//public class GatewayConfiguration {
//
//    private final List<ViewResolver> viewResolvers;
//    private final ServerCodecConfigurer serverCodecConfigurer;
//
//    public GatewayConfiguration(ObjectProvider<List<ViewResolver>> viewResolversProvider,
//                                ServerCodecConfigurer serverCodecConfigurer) {
//        this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
//        this.serverCodecConfigurer = serverCodecConfigurer;
//    }
//
////    @Bean
////    @Order(Ordered.HIGHEST_PRECEDENCE)
////    public SentinelGatewayBlockExceptionHandler sentinelGatewayBlockExceptionHandler() {
////        // Register the block exception handler for Spring Cloud Gateway.
////        System.out.println(11);
////        return new SentinelExceptionHandler(viewResolvers, serverCodecConfigurer);
////    }
//
//    /**
//     * 自定义响应参数
//     *
//     * @return
//     */
//    @Bean
//    @Order(Ordered.HIGHEST_PRECEDENCE)
//    public JsonSentinelGatewayBlockExceptionHandler jsonSentinelGatewayBlockExceptionHandler() {
//        System.out.println(222);
//        return new JsonSentinelGatewayBlockExceptionHandler(viewResolvers, serverCodecConfigurer);
//    }
//
//
////    @Bean
////    @Order(-1)
////    public GlobalFilter sentinelGatewayFilter() {
////        return new SentinelGatewayFilter();
////    }
//}